package com.minimalist.common.entity.basic.po;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Table;
import com.minimalist.common.config.mybatis.InsertFullColumnHandler;
import com.minimalist.common.config.mybatis.UpdateFullColumnHandler;
import com.minimalist.common.config.mybatis.bo.BaseEntity;
import java.io.Serial;
import java.io.Serializable;

/**
 * 文件表 实体类。
 *
 * @author 小太阳
 * @since 2024-10-18
 */
@Table(value = "m_file", onInsert = InsertFullColumnHandler.class, onUpdate = UpdateFullColumnHandler.class)
public class MFile extends BaseEntity implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 文件ID
     */
    private Long fileId;

    /**
     * 原文件名
     */
    private String fileName;

    /**
     * 现文件名
     */
    private String newFileName;

    /**
     * 文件大小
     */
    private Long fileSize;

    /**
     * 文件类型
     */
    private String fileType;

    /**
     * 文件基础路径
     */
    private String fileBasePath;

    /**
     * 文件相对路径
     */
    private String filePath;

    /**
     * 文件url
     */
    private String fileUrl;

    /**
     * 文件来源
     */
    private Integer fileSource;

    /**
     * 存储ID
     */
    private Long storageId;

    /**
     * 文件缩略图url
     */
    private String fileThUrl;

    /**
     * 文件缩略图文件名
     */
    private String fileThFilename;

    /**
     * 缩略图文件大小
     */
    private Long fileThSize;

    /**
     * 备注
     */
    private String remark;

    /**
     * 状态  0未使用 1已使用，默认未使用，代码中控制修改为已使用，可以定期清理未使用的文件
     */
    private Integer status;

    /**
     * 租户ID
     */
    @Column(tenantId = true)
    private Long tenantId;

    public MFile() {
    }

    public MFile(Long fileId, String fileName, String newFileName, Long fileSize, String fileType, String fileBasePath, String filePath, String fileUrl, Integer fileSource, Long storageId, String fileThUrl, String fileThFilename, Long fileThSize, String remark, Integer status, Long tenantId) {
        this.fileId = fileId;
        this.fileName = fileName;
        this.newFileName = newFileName;
        this.fileSize = fileSize;
        this.fileType = fileType;
        this.fileBasePath = fileBasePath;
        this.filePath = filePath;
        this.fileUrl = fileUrl;
        this.fileSource = fileSource;
        this.storageId = storageId;
        this.fileThUrl = fileThUrl;
        this.fileThFilename = fileThFilename;
        this.fileThSize = fileThSize;
        this.remark = remark;
        this.status = status;
        this.tenantId = tenantId;
    }

    public Long getFileId() {
        return fileId;
    }

    public void setFileId(Long fileId) {
        this.fileId = fileId;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getNewFileName() {
        return newFileName;
    }

    public void setNewFileName(String newFileName) {
        this.newFileName = newFileName;
    }

    public Long getFileSize() {
        return fileSize;
    }

    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }

    public String getFileType() {
        return fileType;
    }

    public void setFileType(String fileType) {
        this.fileType = fileType;
    }

    public String getFileBasePath() {
        return fileBasePath;
    }

    public void setFileBasePath(String fileBasePath) {
        this.fileBasePath = fileBasePath;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public String getFileUrl() {
        return fileUrl;
    }

    public void setFileUrl(String fileUrl) {
        this.fileUrl = fileUrl;
    }

    public Integer getFileSource() {
        return fileSource;
    }

    public void setFileSource(Integer fileSource) {
        this.fileSource = fileSource;
    }

    public Long getStorageId() {
        return storageId;
    }

    public void setStorageId(Long storageId) {
        this.storageId = storageId;
    }

    public String getFileThUrl() {
        return fileThUrl;
    }

    public void setFileThUrl(String fileThUrl) {
        this.fileThUrl = fileThUrl;
    }

    public String getFileThFilename() {
        return fileThFilename;
    }

    public void setFileThFilename(String fileThFilename) {
        this.fileThFilename = fileThFilename;
    }

    public Long getFileThSize() {
        return fileThSize;
    }

    public void setFileThSize(Long fileThSize) {
        this.fileThSize = fileThSize;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Long getTenantId() {
        return tenantId;
    }

    public void setTenantId(Long tenantId) {
        this.tenantId = tenantId;
    }

    public static MFileBuilder builder() {
        return new MFileBuilder();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        MFile mFile = (MFile) o;
        return java.util.Objects.equals(fileId, mFile.fileId) &&
               java.util.Objects.equals(fileName, mFile.fileName) &&
               java.util.Objects.equals(newFileName, mFile.newFileName) &&
               java.util.Objects.equals(fileSize, mFile.fileSize) &&
               java.util.Objects.equals(fileType, mFile.fileType) &&
               java.util.Objects.equals(fileBasePath, mFile.fileBasePath) &&
               java.util.Objects.equals(filePath, mFile.filePath) &&
               java.util.Objects.equals(fileUrl, mFile.fileUrl) &&
               java.util.Objects.equals(fileSource, mFile.fileSource) &&
               java.util.Objects.equals(storageId, mFile.storageId) &&
               java.util.Objects.equals(fileThUrl, mFile.fileThUrl) &&
               java.util.Objects.equals(fileThFilename, mFile.fileThFilename) &&
               java.util.Objects.equals(fileThSize, mFile.fileThSize) &&
               java.util.Objects.equals(remark, mFile.remark) &&
               java.util.Objects.equals(status, mFile.status) &&
               java.util.Objects.equals(tenantId, mFile.tenantId);
    }

    @Override
    public int hashCode() {
        return java.util.Objects.hash(super.hashCode(), fileId, fileName, newFileName, fileSize, fileType, fileBasePath, filePath, fileUrl, fileSource, storageId, fileThUrl, fileThFilename, fileThSize, remark, status, tenantId);
    }

    public static class MFileBuilder {
        private Long fileId;
        private String fileName;
        private String newFileName;
        private Long fileSize;
        private String fileType;
        private String fileBasePath;
        private String filePath;
        private String fileUrl;
        private Integer fileSource;
        private Long storageId;
        private String fileThUrl;
        private String fileThFilename;
        private Long fileThSize;
        private String remark;
        private Integer status;
        private Long tenantId;

        public MFileBuilder fileId(Long fileId) {
            this.fileId = fileId;
            return this;
        }

        public MFileBuilder fileName(String fileName) {
            this.fileName = fileName;
            return this;
        }

        public MFileBuilder newFileName(String newFileName) {
            this.newFileName = newFileName;
            return this;
        }

        public MFileBuilder fileSize(Long fileSize) {
            this.fileSize = fileSize;
            return this;
        }

        public MFileBuilder fileType(String fileType) {
            this.fileType = fileType;
            return this;
        }

        public MFileBuilder fileBasePath(String fileBasePath) {
            this.fileBasePath = fileBasePath;
            return this;
        }

        public MFileBuilder filePath(String filePath) {
            this.filePath = filePath;
            return this;
        }

        public MFileBuilder fileUrl(String fileUrl) {
            this.fileUrl = fileUrl;
            return this;
        }

        public MFileBuilder fileSource(Integer fileSource) {
            this.fileSource = fileSource;
            return this;
        }

        public MFileBuilder storageId(Long storageId) {
            this.storageId = storageId;
            return this;
        }

        public MFileBuilder fileThUrl(String fileThUrl) {
            this.fileThUrl = fileThUrl;
            return this;
        }

        public MFileBuilder fileThFilename(String fileThFilename) {
            this.fileThFilename = fileThFilename;
            return this;
        }

        public MFileBuilder fileThSize(Long fileThSize) {
            this.fileThSize = fileThSize;
            return this;
        }

        public MFileBuilder remark(String remark) {
            this.remark = remark;
            return this;
        }

        public MFileBuilder status(Integer status) {
            this.status = status;
            return this;
        }

        public MFileBuilder tenantId(Long tenantId) {
            this.tenantId = tenantId;
            return this;
        }

        public MFile build() {
            return new MFile(fileId, fileName, newFileName, fileSize, fileType, fileBasePath, filePath, fileUrl, fileSource, storageId, fileThUrl, fileThFilename, fileThSize, remark, status, tenantId);
        }
    }

}
